#include "Memory.h"

Memory::Memory(IArduino& arduino, MessageRouter& router, ILogger& logger, long checkPeriod /* = 1000*/)
: Service(arduino, router, F("__MEM__"), logger), 
	lastCheckTime_(0),
	checkPeriod_(checkPeriod){}
void Memory::tick(long milliseconds) {
	if(milliseconds >= lastCheckTime_ + checkPeriod_){
		lastCheckTime_ = milliseconds;
		postMessage(String(F("{\"dbg\":\"mem\", \"val\":\"")) + arduino_.availableMem() + F("\"}"));
	}
}
bool Memory::isInfrastructure() const{
	return true;
}